<?php
require_once 'config.php';
require_once 'function.php';
require_once 'class/Mysql.class.php';

$db = new Mysql();

//替换后的cbs id
$cbsid_arr = array(
31,
191,
6,
678,
595,
751,
526,
619,
465,
49,
1010,
386,
235,
905,
1052,
1037,
974,
944,
1084,
902,
899,
1066,
998,
911,
914,
916,
920,
923,
926,
935,
938
);

//paypal
$paypal = array(
'http://store.wondershare.com/index.php?method=index&pid=31&license_id=11&sub_lid=5260&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=191&license_id=11&sub_lid=5261&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=6&license_id=11&sub_lid=5262&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=678&license_id=11&sub_lid=5263&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=595&license_id=11&sub_lid=5264&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=751&license_id=11&sub_lid=5265&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=526&license_id=11&sub_lid=5266&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=619&license_id=11&sub_lid=5267&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=465&license_id=11&sub_lid=5268&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=49&license_id=11&sub_lid=5269&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=1010&license_id=11&sub_lid=5271&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=386&license_id=11&sub_lid=5272&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=235&license_id=11&sub_lid=5273&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=905&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=1052&license_id=11&sub_lid=0&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=1037&license_id=11&sub_lid=0&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=974&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=944&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=1084&license_id=11&sub_lid=0&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=902&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=899&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=1066&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=998&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=911&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=914&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=916&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=920&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=923&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=926&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=935&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR',
'http://store.wondershare.com/index.php?method=index&pid=938&license_id=11&sub_lid=0&payment=paypal&language=French&currency=EUR'
);

$shareit = array(
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531714]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531716]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531718]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531719]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531721]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531722]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531723]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531724]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531725]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531726]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531728]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531729]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300531730]=1&cartcoupon=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518127]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300523354]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300525520]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518129]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518124]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518126]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518125]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518131]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518132]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518137]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518138]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518139]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518140]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518141]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518142]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518147]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518148]=1&languageid=6&cookies=1&currencies=EUR',
'https://secure.shareit.com/shareit/cart.html?PRODUCT[300518109]=1&languageid=6&cookies=1&currencies=EUR'
);

//打勾价
$price = array(
159.99,
39.99,
79.99,
39.99,
24.99,
24.99,
12.99,
29.99,
24.99,
79.99,
49.99,
24.99,
24.99,
49.99,
34.99,
29.99,
19.99,
45.99,
39.99,
49.99,
29.99,
39.99,
39.99,
45.00,
59.00,
45.00,
59.00,
39.99,
79.99,
29.99,
69.99
);

foreach( $cbsid_arr as $k=>$v ){
	$db->update('license',array('shareit_url'=>$shareit[$k],'cart_url'=>$paypal[$k],'price'=>$price[$k]), 'product_cbs_id='.$v.' AND website_display=1');
}


//cbs id => 原价
$arr = array(
	595=>34.99,
	619=>39.99,
	465=>34.99,
	386=>34.99
);

foreach( $arr as $k=>$v ){
	$db->update('license',array('price'=>$v), 'product_cbs_id='.$k.' AND license_id = 11 AND sub_license_id = 0');
}

echo 'ok';

